using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WinForm
{
    public partial class FormEmployeeStatus : Form
    {
        #region variable
        public Point FormLocation;
        #endregion

        public FormEmployeeStatus() : this(new Point(100, 100)) { }
        public FormEmployeeStatus(Point formPoint)
        {
            InitializeComponent();
            this.FormLocation = formPoint;

            Initial();
        }

        private void FormEmployeeStatus_Load(object sender, EventArgs e)
        {
            this.Location = this.FormLocation;
        }

        private void Initial()
        {
            this.dataGridViewBuzy.AutoGenerateColumns = false;
            this.dataGridView2.AutoGenerateColumns = false;

            Graduate.BLL.Sale.SaleOrder thisSaleOrder = new Graduate.BLL.Sale.SaleOrder();
            this.dataGridViewBuzy.DataSource = thisSaleOrder.GetModelList("");
            List<Graduate.Model.Employee.Employee> thisEmployeeList = new List<Graduate.Model.Employee.Employee>();
            Graduate.BLL.Employee.Employee thisEmployee = new Graduate.BLL.Employee.Employee();
            foreach (Graduate.Model.Employee.Employee employee in thisEmployee.GetModelList(""))
            {
                bool isBusy = false;
                foreach (Graduate.Model.Sale.SaleOrder saleorder in thisSaleOrder.GetModelList(""))
                {
                    if (employee.ID == saleorder.EmployeeID)
                    {
                        isBusy = true;
                        break;
                    }
                }
                if(!isBusy)
                {
                    thisEmployeeList.Add(employee);
                }
            }
            this.dataGridView2.DataSource = thisEmployeeList;

            
        }
    }
}
